package com.sqstudio.exercise.chapter4{
	
	import flash.display.BitmapData;
	import flash.display.Shape;
	import flash.events.Event;
	
	import org.papervision3d.materials.BitmapMaterial;
	import org.papervision3d.objects.primitives.Plane;
	import org.papervision3d.view.BasicView;

	[SWF(width="800",height="600")]
	
	/**
	 *位图材质----图形shape 
	 * @author Nestor
	 * 
	 */	
	public class BitmapMaterialShapeExample extends BasicView
	{
		public function BitmapMaterialShapeExample(viewportWidth:Number=800, viewportHeight:Number=600, scaleToStage:Boolean=true, interactive:Boolean=false, cameraType:String="Target")
		{
			super(viewportWidth, viewportHeight, scaleToStage, interactive, cameraType);
			stage.frameRate = 40;
			init();
			this.startRendering();
		}
		
		private function init():void{
			
			var circle:Shape = new Shape();
			circle.graphics.beginFill(0xff0000);
			circle.graphics.drawCircle(100,100,100);
			circle.graphics.endFill();
			
			var bmd:BitmapData = new BitmapData(200,200,true,0x000000);
			bmd.draw(circle);
			
			var material:BitmapMaterial = new BitmapMaterial(bmd);
			material.smooth = true;//平滑设置
			var plane:Plane = new Plane(material);
			scene.addChild(plane);
			
		}
		
		override protected function onRenderTick(event:Event=null):void
		{
			super.onRenderTick(event);
		}
	}
}